import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/layout/index.vue'
Vue.use(VueRouter)

const routes = [
	// 登录
	{
		path: '/login',
		name: 'Login',
		component: () => import('@/views/login/index'),
		hidden: true
	},
	// s首页
	{
		path: '/',
		component: Layout,
		redirect: '/home',
		children: [
			{
				path: 'home',
				component: () => import('@/views/home/index.vue'),
			}
		]
	},
	// 表格
	{
		path: '/table',
		component: Layout,
		redirect: '/table/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/table/index.vue'),
			}
		]
	},
	// tab
	{
		path: '/tab',
		component: Layout,
		redirect: '/tab/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/tab/index.vue'),
			}
		]
	},
	// 图表
	{
		path: '/chart',
		component: Layout,
		redirect: '/chart/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/chart/index.vue'),
			},
			{
				path: 'chartTwo',
				component: () => import('@/views/chart/chartTwo.vue'),
			},
			{
				path: 'chartThree',
				component: () => import('@/views/chart/chartThree.vue'),
			}
		]
	},
	// 文档
	{
		path: '/document',
		component: Layout,
		redirect: '/document/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/document/index.vue'),
			}
		]
	},
	// store 使用
	{
		path: '/testStore',
		component: Layout,
		redirect: '/testStore/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/testStore/index.vue'),
			}
		]
	},
	// node 使用场景
	{
		path: '/node',
		component: Layout,
		redirect: '/node/spider',
		children: [
			{
				path: 'spider',
				component: () => import('@/views/node/index.vue'),
			},
			{
				path: 'chatroom',
				component: () => import('@/views/node/chatroom.vue'),
			}
		]
	},
	// Permission
	// 权限设置
	{
		path: '/permission',
		component: Layout,
		redirect: '/permission/index',
		children: [
			{
				path: 'index',
				component: () => import('@/views/permission/index.vue'),
			}
		]
	},
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
